<?php

require 'TVB/pms/pdes/common/global_data.php';

if(empty($_REQUEST['type'])){
	exit('[]');
}else{
	$type = $_REQUEST['type'];
}

if( !isset(PDES_GD::$$type) ) {
	exit('[]');
}

if( isset($_REQUEST['id']) ){
	$id   = (int)$_REQUEST['id'];
	$arr  = PDES_GD::$$type;
	$data = $arr[$id];
}else{
	$data = PDES_GD::$$type;
}


if(is_array($data)){
	foreach($data as $k=>$v){
		$obj->$k = $v;
	}
}else{
	$obj->$id = $data;
}

echo json_encode($obj);

?>
